﻿// -----------------------------------------------------------------------
// <copyright file="PageInfo.cs" company="">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------

namespace NetFramework.Router.Configuration
{
    using System;
    using System.Xml.Serialization;

    /// <summary>
    /// TODO: Update summary.
    /// </summary>
    [Serializable]
    public class PageInfo
    {
        /// <summary>
        /// 获取或设置页面名称
        /// </summary>
        [XmlAttribute("page")]
        public string PageName { get; set; }

        /// <summary>
        /// 获取或设置所属站点
        /// </summary>
        [XmlAttribute("site")]
        public string Site { get; set; }

        /// <summary>
        /// 获取或设置页面相对路径
        /// </summary>
        [XmlAttribute("path")]
        public string RelatedPath { get; set; }

        /// <summary>
        /// 虚拟路径，以“~/”开头
        /// </summary>
        public string VirtualPath
        {
            get
            {
                if (this.RelatedPath.StartsWith("~/"))
                {
                    return this.RelatedPath;
                }
                else
                {
                    return "~/" + this.RelatedPath;
                }
            }
        }
    }
}
